Technical Q&As


The Apple Media Tool and Apple Media Tool Programming Environment products have been discontinued. For more information check out: AMT/PE Discontinued.

AMT_PE 02 - Using Color Palettes with Apple Media Tool (1-May-95)


Q How can I use custom palettes with my 8-bit projects in AMT/PE?

A Until recently, the only way was to write custom C code for Macintosh and Windows. Art Technology Group's "GearHead" project on the AMK Demo CD provides a prototype for writing this kind of code. (There is also Color Palette sample code in the sample code folder on the Demo CD, but be forewarned: the final application is missing two 'pltt' resources - id #1500 and #2500 - you need to add yourself if you want to see it work properly.)

With custom palette support in QuickTime 2.0, there's a new and easier way to integrate custom palettes using the AMT Programming Environment. Basically, the trick is to have one QuickTime movie on each AMK "screen" with a custom palette, and make the following change to moviehandler.c (and MOVIEHA_.C on the PC side), so that AMK recognizes and uses the palette from the QuickTime movie. Here's how it works:

Open moviehandler.c or MOVIEHA_.C, and find the line:

       MCDoAction(aController, mcActionSetLooping,
        (void*)keyToBoolean(keyCall0(the[SELF], K_ISLOOPING)));
Insert these lines after it:
{
   long controllerFlags;
   MCDoAction(aController, mcActionGetFlags, &controllerFlags);
   MCDoAction(aController, mcActionSetFlags, (void *) (controllerFlags |
   mcFlagsUseWindowPalette));
}
 
The next time you build your project on the Macintosh, the moviehandler.c file will be recompiled for you. On the PC, you'll need to rebuild the RUNTIME.MAK project.

To create a movie with a custom palette, your best bet is to use Debabelizer 1.5. This tool lets you analyze all the media on each screen and create the best palette for each. Then you can export the palette from Debabelizer. "Making a Color Table," which is available on the QuickTime 2.0 CD, describes in detail how to use Debabelizer to accomplish this. Finally, what you do is attach the palette to the movie using Movie Player 2.0. (Make sure you use the "Goodies" and "Authoring Extras" plug-ins in the same folder as Movie Player 2.0, and follow the instructions on page 55 of the MoviePlayer 2.0 documentation.)

A couple of caveats you ought to keep mind:

1. Remember that the last movie with a color table to be loaded on a given screen will control the palette for the entire screen. So it's important to consider the other media assets on the screen when you create the movie's color table, and make sure you assign the palette to the correct movie. Otherwise, your other media may appear posterized.

2. Screen-savers (and task-switching) on the PC will cause the palette to be switched back to the Macintosh palette unless you do some additional tweaking in APPLICA_.C.

Technical Q&As
Previous Question | Contents | Next Question